import { http } from '@/utils/http/axios';

/**
 * @description: 权限列表
 */
export function permissionsList(data?) {
  return http.request({
    url: '/permissions/search',
    method: 'post',
    data,
  });
}

/**
 * @description: 权限列表(不分页)
 */
export function permissionsGather() {
  return http.request({
    url: '/permissions',
    method: 'get',
  });
}

/**
 * @description: 添加权限
 */
export function addPermission(data) {
  return http.request({
    url: '/permission',
    method: 'post',
    data,
  });
}

/**
 * @description: 权限信息
 */
export function permissionInfo(id) {
  return http.request({
    url: `/permission/${id}`,
    method: 'get',
  });
}

/**
 * @description: 编辑权限
 */
export function editPermission(data) {
  return http.request({
    url: '/permission',
    method: 'PATCH',
    data,
  });
}

/**
 * @description: 删除权限
 */
export function deletePermission(id) {
  return http.request({
    url: `/permission/${id}`,
    method: 'delete',
  });
}

/**
 * @description: 导出权限
 */
export function exportPermissions(data) {
  return http.request({
    url: '/permissions/export',
    method: 'post',
    data,
  });
}
